<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../link/heat.jsp" %>
<html>
<head>
    <title>年客户增长</title>
    <!-- 引入 echarts.js -->
    <script src="${pageContext.request.contextPath}/static/js/echarts.min.js"></script>
</head>
<body>
<div id="main" style="width: 600px;height:400px;">

</div>
<script>
    var myChart = echarts.init(document.getElementById('main'));
    // 显示标题，图例和空的坐标轴
    myChart.setOption({
        title: {
            text: '年客户注册'
        },
        tooltip: {},
        legend: {
            data: ['注册']
        },
        xAxis: {
            data: []
        },
        yAxis: {},
        series: [{
            name: '销量',
            type: 'bar',
            data: []
        }]
    });
    // 异步加载数据
    $.get('${pageContext.request.contextPath}/view/viewCustomer.action', function (data) {
        alert(data)
        // 填入数据
        myChart.setOption({
            xAxis: {
                data: data.year
            },
            series: [{
                // 根据名字对应到相应的系列
                name: '销量',
                data: data.count
            }]
        });
    }, 'json')
</script>
</body>
</html>
